<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../inc/conn.asp"-->
<!--#include file="../../inc/md5.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录</title>
<meta name="keywords" content="登录" />
<meta name="description" content="登录" />
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script>
function myjobchk(){
if (document.formcn.username.value=="")
{alert("用户名不能为空");
document.formcn.username.focus();
return false;
}
if (document.formcn.password.value=="")
{alert("密码不能为空");
document.formcn.password.focus();
return false;
}        
return(true);
}
</script>

</head>
<body>



<!--#include file="../common/top.asp"-->




<div class="fullwidth bg2">
	<div class="place ">
		<a href="/">首页</a> &gt; 登录
	</div>
</div>
<!--main-->
<div class="fullwidth bg1">
	<div class="main">
	
		<div class="login">
			<div class="pic"><img src="images/img_xxx_5.jpg" /></div>
			<div class="login_r">
                <form name="formcn" method="post" action="" onSubmit="return myjobchk();" class="login_form">
					<dl>
						<dd><span class="span_left">用户名：</span><input type="text" style="text-indent:5px" name="username" class="text reg_ico_1" /></dd>
						<dd><span class="span_left">密码：</span><input type="password" style="text-indent:5px" name="password" class="text reg_ico_2" /></dd>
						<dd>
							<span class="span_left f_l"></span>
							<label for="remember" class="f_l"><input name="isRemember" type="checkbox" id="isRemember" value="1" checked="checked" />下次自动登录</label>
							<a href="/reset" class="f_r">忘记密码?</a>
						</dd>
						<dd>
							<span class="span_left f_l"></span>
							<a href="/reg" class="reg_btn">注册</a>
                            <input type="submit" value="登录" class="login_btn btn4" />
                            <input type="hidden" name="t" value="y" />
						</dd>
					</dl>
				</form>
			</div>
		</div>
		
	</div>
</div>

<div class="clear"></div>




<!--#include file="../common/footer.asp"-->



</body>
</html>
<%
if request.Form("t")="y" then
username=checkstr(inHTML(request("username")))
password=checkstr(inHTML(request("password")))
isRemember=checkstr(inHTML(request("isRemember")))
returnurl=session("returnurl")

if username="" or password="" then
response.write"<script>alert('邮箱、密码不能为空');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select * from [user] where (mail='"&username&"' or username='"&username&"' or mobile='"&username&"') and password='"&md5(password)&"' and mark=1"
rs.open sql,conn,1,3
if  rs.eof then
response.write"<script>alert('用户名或密码错误');</script>"
response.write"<script>window.history.back(-1);</script>"
response.end
else
response.cookies("u")("mail")=rs("mail")
response.cookies("u")("username")=rs("username")
response.cookies("u")("Password")=rs("Password")
response.cookies("u")("uid")=rs("uid")
  if isRemember<>"" then
	dim ctime
	ctime=5256000
	ctime=dateadd("n",ctime,now())
	response.cookies("u").expires=ctime
  end if
end if

if returnurl="" then
response.Redirect "/user"
else
session("returnurl")=""
response.write"<script>window.location.href='"&returnurl&"';</script>"
end if

rs.close
set rs=nothing
end if
%>
